<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表格查询</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>


<div class="demoTable" style="margin-left: 15px;">
    <form class="layui-form " action="" >
    <div class="layui-form-item">
        <label>门店编号</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopSn" id="shopSn" autocomplete="off">
        </div>
        <label>店铺类型</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopType" id="shopType" autocomplete="off">
        </div>
        <label> 是否自营</label>
        <div class="layui-inline">
            <select id="isSelf" lay-filter="isSelf">
                <option value="">请选择..</option>
                <option value="1">自营</option>
                <option value="2">非自营</option>
            </select>
        </div>
        <label>门店名称</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopName" id="shopName" autocomplete="off">
        </div>
        <label>店主</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopKeeper" id="shopKeeper" autocomplete="off">
        </div>
        <label>店主手机号</label>
        <div class="layui-inline">
            <input class="layui-input" name="telePhone" id="telePhone" autocomplete="off">
        </div>
        <label>公司名称</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopCompany" id="shopCompany" autocomplete="off">
        </div>
        <label>门店电话</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopTel" id="shopTel" autocomplete="off">
        </div>
        <label>门店地址</label>
        <div class="layui-inline">
            <input class="layui-input" name="shopAddress" id="shopAddress" autocomplete="off">
        </div>
        <label>能否开发票</label>
        <div class="layui-inline">
            <select id="isInvoice" lay-filter="isInvoice">
                <option value="">请选择..</option>
                <option value="1">能</option>
                <option value="2">不能</option>
            </select>
        </div>
        <label>门店状态</label>
        <div class="layui-inline">
            <select id="shopAtive" lay-filter="shopAtive">
                <option value="">请选择..</option>
                <option value="1">营业中</option>
                <option value="2">休息中</option>
            </select>
        </div>
        <label>门店状态</label>
        <div class="layui-inline">
            <select id="shopStatus" lay-filter="shopStatus">
                <option value="">请选择..</option>
                <option value="1">已审核</option>
                <option value="2">未审核</option>
                <option value="3">拒绝</option>
                <option value="4">已停止</option>
            </select>
        </div>
        <button type="button" class="layui-btn" data-type="reload">
            <i class="layui-icon layui-icon-search">搜索</i>
        </button>
    </div>
    </form>
</div>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="toolbarDemo">


    <form class="layui-form " action="">
        <div class="layui-form-item" style="margin-left: 15px;">
            <div class="layui-btn-group">
              <#--  <button type="button" class="layui-btn" lay-event="add">增加</button>
                <button type="button" class="layui-btn" lay-event="edit">编辑</button>
                <button type="button" class="layui-btn" lay-event="del">删除</button>-->
                <button type="button" class="layui-btn" lay-event="show">查看</button>
            </div>
        </div>

    </form>
</script>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['table'], function () {
        var table = layui.table;
        table.render({
            skin: 'line' //行边框风格
            , even: true //开启隔行背景
            , elem: '#test'
            , url: base + '/admin/shopShops/findShopShopsByPage'
            , toolbar: '#toolbarDemo'
            , cols: [[
                {type: 'radio'},
                     {field: 'shopName', title: '门店名称'},
                  {field: 'isSelf', title: '是否自营', templet: function(val){
                          if(val.isSelf==1){
                              return "自营";
                          }  if(val.isSelf==2){
                              return "非自营";
                          }
                      }},
                  {field: 'shopKeeper', title: '店主'},
                  {field: 'telePhone', title: '店主手机号'},
                  {field: 'shopCompany', title: '公司名称'},
                  {field: 'shopTel', title: '门店电话'},
                  {field: 'shopAddress', title: '门店地址'},
                  {field: 'isInvoice', title: '能否开发票', templet: function(val){
                          if(val.isInvoice==1){
                              return "能";
                          }  if(val.isInvoice==2){
                              return "不能";
                          }
                      }},
                  {field: 'serviceStarttime', title: '服务营业时间'},
                  {field: 'serviceEndTime', title: '服务打样时间'},
                  {field: 'shopAtive', title: '门店状态', templet: function(val){
                          if(val.shopAtive==1){
                              return "营业中";
                          }  if(val.shopAtive==2){
                              return "休息中";
                          }
                      }},
                  {field: 'shopStatus', title: '门店状态', templet: function(val){
                          if(val.shopStatus==1){
                              return "已审核";
                          }  if(val.shopStatus==2){
                              return "未审核";
                          } if(val.shopStatus==3){
                              return "拒绝";
                          } if(val.shopStatus==4){
                              return "已停止";
                          }
                      }},
            ]]
            , page: true
            , id: 'testReload'
        });
        //搜索
        var $ = layui.$, active = {
            reload: function(){
                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                                    shopSn:$("#shopSn").val(),
                                    shopType:$("#shopType").val(),
                                    userId:$("#userId").val(),
                                    adminUserId:$("#adminUserId").val(),
                                    isSelf:$("#isSelf").val(),
                                    shopName:$("#shopName").val(),
                                    shopKeeper:$("#shopKeeper").val(),
                                    telePhone:$("#telePhone").val(),
                                    shopCompany:$("#shopCompany").val(),
                                    shopImg:$("#shopImg").val(),
                                    shopTel:$("#shopTel").val(),
                                    shopQq:$("#shopQq").val(),
                                    shopAddress:$("#shopAddress").val(),
                                    bankId:$("#bankId").val(),
                                    bankNo:$("#bankNo").val(),
                                    bankSerName:$("#bankSerName").val(),
                                    isInvoice:$("#isInvoice").val(),
                                    invoiceRemarks:$("#invoiceRemarks").val(),
                                    serviceStarttime:$("#serviceStarttime").val(),
                                    serviceEndTime:$("#serviceEndTime").val(),
                                    shopAtive:$("#shopAtive").val(),
                                    shopStatus:$("#shopStatus").val(),
                                    statusDesc:$("#statusDesc").val(),
                                    createTime:$("#createTime").val(),
                                    shopMoney:$("#shopMoney").val(),
                                    lockMoney:$("#lockMoney").val()
                    }
                }, 'data');
            }
        };
        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });





        //头工具栏事件
        table.on('toolbar(test)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
            var data = checkStatus.data;  //获取选中行数据
            switch (obj.event) {
                case 'add':
                    //请继续补充以下逻辑
                    window.location.href=base+"/admin/shopShops/addShopShopsHtml"
                    break;
                case 'edit':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    //请继续补充以下逻辑
                    window.location.href=base+"/admin/shopShops/editShopShopsHtml?id=" + data[0].id
                    break;
                case 'show':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    //请继续补充以下逻辑
                    window.location.href=base+"/admin/shopShops/showShopShopsHtml?id=" + data[0].id
                    break;
                case 'del':
                    if (data.length === 0) {
                        layer.alert("请选择一条数据")
                        return;
                    }
                    layer.confirm('真的要删除吗?',function(index){
                        $.ajax({
                            type:"POST",
                            url:base+'/admin/shopShops/delShopShops',
                            data:{"id":data[0].id},
                            success:function(data){
                                if(data.code===10000){
                                    layer.msg(data.message)
                                    setTimeout(function () {
                                        window.location.reload();
                                    }, 500)
                                }else{
                                    layer.msg(data.message)
                                }
                            }
                        });
                    });
                    break;
            };
        });
    })
</script>
</body>
</html>